#include <iostream>
#include <cmath>

using namespace std;

const int N = 1e4 + 10;

int a[N];
int n;

void deprime(int n)
{
	for(int i = 2; i <= n; i++)
	{
		int x = i;
		for(int j = 2; j <= x / j; j++)
		{
			int cnt = 0;
			while(x % j == 0)
			{
				cnt++;
				x /= j;
			}
			a[j] += cnt;
		}
		if(x > 1) a[x]++;
	}
}

int main()
{
	cin >> n;
	
	deprime(n);
	
	for(int i = 2; i <= n; i++)
		if(a[i] != 0) 
			cout << i << " " << a[i] << endl;
	
	return 0;
} 
